//
//  MyController.m
//
//  Created by dryJ on 25/01/2010.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "MyController.h"

@implementation MyController
- (IBAction)buttonPressed:(UIBarButtonItem *)sender {
    double varA, varB, varC, varPosX, varNegX, varDiscriminant;
	varA = [inputA.text doubleValue];
	varB = [inputB.text doubleValue];
	varC = [inputC.text doubleValue];
	
	varPosX = ( (-varB + sqrt(varB*varB - (4*varA*varC) ) ) / (2*varA));
	varNegX = ( (-varB - sqrt(varB*varB - (4*varA*varC) ) ) / (2*varA));
	
	varDiscriminant = sqrt(varB*varB - 4*varA*varC);
	
	labelDiscriminant.text = [NSString stringWithFormat:@"%.1f", varDiscriminant];
	negValueX.text = [NSString stringWithFormat:@"%.1f", varNegX];
	posValueX.text = [NSString stringWithFormat:@"%.1f", varPosX];
	
}
@end
